<?php


if (!function_exists('getTree')){
     function getTree($data,$fid=0,$lev=1){
        static  $list = [];
        foreach ($data as $v){
            if ($v['fid'] == $fid){
                $v['lev'] = $lev;
                $list[] = $v;
               getTree($data,$v['pid'],$lev+1);
            }
        }
        return $list;
    }
}


if (!function_exists('send_message')){
    function send_message($tel){
        $smsapi = "http://api.smsbao.com/";
        $user = "desa"; //短信平台帐号
        $pass = md5("woaini"); //短信平台密码
        $content="抢票成功，请在15分钟内去支付";//要发送的短信内容
        $phone = $tel;//要发送短信的手机号码
        $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
        $result =file_get_contents($sendurl) ;
       return $result;
    }
}